package org.nanotek.cms.domain.lucene.config;

import java.util.Date;
import java.util.Set;

import org.nanotek.cms.domain.AbstractBase;
import org.nanotek.util.Base;

@SuppressWarnings("serial")
public class IndexConfig implements Base<Long> {


	private Long id;
	private String path;
	private Long version;
	private Long openMode;
	private Long indexType;
	private Long analyzerType;
	private Date dataUpdate;
	private Date dateInsert;

	private Set<IndexConfigParameter> indexConfigParameters;

	@Override
	public Long getId() {
		return id;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public Long getVersion() {
		return version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

	public Long getOpenMode() {
		return openMode;
	}

	public void setOpenMode(Long openMode) {
		this.openMode = openMode;
	}

	public Long getIndexType() {
		return indexType;
	}

	public void setIndexType(Long indexType) {
		this.indexType = indexType;
	}

	public Date getDataUpdate() {
		return dataUpdate;
	}

	public void setDataUpdate(Date dataUpdate) {
		this.dataUpdate = dataUpdate;
	}

	public Date getDateInsert() {
		return dateInsert;
	}

	public void setDateInsert(Date dateInsert) {
		this.dateInsert = dateInsert;
	}

	public Set<IndexConfigParameter> getIndexConfigParameters() {
		return indexConfigParameters;
	}

	public void setIndexConfigParameters(
			Set<IndexConfigParameter> indexConfigParameters) {
		this.indexConfigParameters = indexConfigParameters;
	}

	public void setId(Long id) {
		this.id = id;
	}


	public Long getAnalyzerType() {
		return analyzerType;
	}

	public void setAnalyzerType(Long analyzerType) {
		this.analyzerType = analyzerType;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((analyzerType == null) ? 0 : analyzerType.hashCode());
		result = prime * result
				+ ((dataUpdate == null) ? 0 : dataUpdate.hashCode());
		result = prime * result
				+ ((dateInsert == null) ? 0 : dateInsert.hashCode());
		result = prime
				* result
				+ ((indexConfigParameters == null) ? 0 : indexConfigParameters
						.hashCode());
		result = prime * result
				+ ((indexType == null) ? 0 : indexType.hashCode());
		result = prime * result
				+ ((openMode == null) ? 0 : openMode.hashCode());
		result = prime * result + ((path == null) ? 0 : path.hashCode());
		result = prime * result + ((version == null) ? 0 : version.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		IndexConfig other = (IndexConfig) obj;
		if (analyzerType == null) {
			if (other.analyzerType != null)
				return false;
		} else if (!analyzerType.equals(other.analyzerType))
			return false;
		if (dataUpdate == null) {
			if (other.dataUpdate != null)
				return false;
		} else if (!dataUpdate.equals(other.dataUpdate))
			return false;
		if (dateInsert == null) {
			if (other.dateInsert != null)
				return false;
		} else if (!dateInsert.equals(other.dateInsert))
			return false;
		if (indexConfigParameters == null) {
			if (other.indexConfigParameters != null)
				return false;
		} else if (!indexConfigParameters.equals(other.indexConfigParameters))
			return false;
		if (indexType == null) {
			if (other.indexType != null)
				return false;
		} else if (!indexType.equals(other.indexType))
			return false;
		if (openMode == null) {
			if (other.openMode != null)
				return false;
		} else if (!openMode.equals(other.openMode))
			return false;
		if (path == null) {
			if (other.path != null)
				return false;
		} else if (!path.equals(other.path))
			return false;
		if (version == null) {
			if (other.version != null)
				return false;
		} else if (!version.equals(other.version))
			return false;
		return true;
	}
}
